<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('内部案例库列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>日期：</label>
                                <input type="text" class="time-input" placeholder="请选择日期" name="date"/>
                            </li>
                            <li>
                                <label>作者：</label>
                                <input type="text" name="author"/>
                            </li>
                            <li>
                                <label>零件名称：</label>
                                <select name="partName" th:with="type=${@dict.getType('sys_part')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>零件所属类别：</label>
                                <input type="text" name="partCategoryId"/>
                            </li>
                            <li>
                                <label>故障模式：</label>
                                <select name="failureModeId" th:with="type=${@dict.getType('sys_failure_mode')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>故障所属类别：</label>
                                <select name="failureCategoryId" th:with="type=${@dict.getType('sys_failure_category')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>材料牌号：</label>
                                <input type="text" name="materialBrand"/>
                            </li>
                            <li>
                                <label>材料所属类别：</label>
                                <select name="materialCategoryId" th:with="type=${@dict.getType('sys_material')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>航空型号：</label>
                                <select name="aviationModel" th:with="type=${@dict.getType('sys_aviation_model')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <label>委托方：</label>
                                <input type="text" name="client"/>
                            </li>
                            <li>
                                <label>分析时间：</label>
                                <input type="text" class="time-input" placeholder="请选择分析时间" name="analysisTime"/>
                            </li>
                            <li>
                                <label>归档时间：</label>
                                <input type="text" class="time-input" placeholder="请选择归档时间" name="archiveTime"/>
                            </li>
                            <li>
                                <label>信息来源：</label>
                                <input type="text" name="informationSource"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">

                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="internal:internal:export">
                    <i class="fa fa-download"></i> 下载
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('internal:internal:edit')}]];
        var removeFlag = [[${@permission.hasPermi('internal:internal:remove')}]];
        var partNameDatas = [[${@dict.getType('sys_part')}]];
        var failureModeIdDatas = [[${@dict.getType('sys_failure_mode')}]];
        var failureCategoryIdDatas = [[${@dict.getType('sys_failure_category')}]];
        var materialCategoryIdDatas = [[${@dict.getType('sys_material')}]];
        var aviationModelDatas = [[${@dict.getType('sys_aviation_model')}]];
        var prefix = ctx + "internal/internal";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                detailUrl: prefix + "/detail/{id}",
                modalName: "内部案例库",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'date',
                    title: '日期'
                },
                {
                    field: 'author',
                    title: '作者'
                },
                {
                    field: 'partName',
                    title: '零件名称',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(partNameDatas, value);
                    }
                },
                {
                    field: 'partCategoryId',
                    title: '零件所属类别'
                },
                {
                    field: 'failureModeId',
                    title: '故障模式',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(failureModeIdDatas, value);
                    }
                },
                {
                    field: 'failureReason',
                    title: '故障原因'
                },
                {
                    field: 'failureCategoryId',
                    title: '故障所属类别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(failureCategoryIdDatas, value);
                    }
                },
                {
                    field: 'failureInfo',
                    title: '失效信息'
                },
                {
                    field: 'materialBrand',
                    title: '材料牌号'
                },
                {
                    field: 'materialCategoryId',
                    title: '材料所属类别',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(materialCategoryIdDatas, value);
                    }
                },
                {
                    field: 'aviationModel',
                    title: '航空型号',
                    formatter: function(value, row, index) {
                       return $.table.selectDictLabel(aviationModelDatas, value);
                    }
                },
                {
                    field: 'routeType',
                    title: '航线类型'
                },
                {
                    field: 'client',
                    title: '委托方'
                },
                {
                    field: 'analysisTime',
                    title: '分析时间'
                },
                {
                    field: 'archiveTime',
                    title: '归档时间'
                },
                {
                    field: 'informationSource',
                    title: '信息来源'
                },
                {
                    field: 'basicSituation',
                    title: '基本情况'
                },
                {
                    field: 'caseFullText',
                    title: '案例全文'
                },
                {
                    title: '操作',
                    align: 'center',
                    width: 140,
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.detail(' + row.id + ')"><i class="fa fa-edit"></i>浏览</a> ');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>